package utlis;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class dbUtils {
    private static Properties props=null;
    static{
        InputStream is=null;
        is=dbUtils.class.getClassLoader().getResourceAsStream("db.properties");
        if(is==null){
            throw new RuntimeException("找不到数据库配置文件！");
        }
        props=new Properties();
        try {
            props.load(is);
        } catch (IOException e) {
            throw new RuntimeException("数据库配置参数加载错误！");
        }finally {
            try {
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    public static String getMyproperties(String key){
        return props.getProperty(key);
    }

}
